package com.inei.eea2014.controller.activity;

import com.inei.eea2014.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Login_Activity extends Activity {

	// componentes
	private EditText etUsuario;
	private Button btnIngresar, btnSalir;

	// variables

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login);

		IniciarComponentes();

		AgregarEventos();

		CargarDatos();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login, menu);
		return true;
	}

	private void IniciarComponentes() {
		etUsuario = (EditText) findViewById(R.id.etUsuario);

		btnIngresar = (Button) findViewById(R.id.btnIngresar);
		btnSalir = (Button) findViewById(R.id.btnSalir);
	}

	private void AgregarEventos() {
		btnIngresar.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent ir_menu = new Intent(getApplicationContext(),
						Marco_Activity.class);
				Bundle datos = new Bundle();
				datos.putString("USUARIO", etUsuario.getText().toString());
				ir_menu.putExtras(datos);
				startActivity(ir_menu);
				finish();
			}
		});

		btnSalir.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				finish();
			}
		});
	}

	private void CargarDatos() {
		// TODO Auto-generated method stub

	}
}
